package com.ty.day2.home;

import java.util.Random;

/**
 * Created by IntelliJ IDEA.
 *
 * @author : txy
 * @create : 2023/11/15 19:04
 */
public class Shop {
    public static void main(String[] args) {
        randomPC();
    }

    public static void randomPC() {
        Board[] bList = new Board[5];
        GPU[] gList = new GPU[5];
        CPU[] cList = new CPU[5];
        Memory[] mList = new Memory[5];

        for (int i = 0; i < 5; i++) {
            Board board = new Board();
            GPU gpu = new GPU();
            CPU cpu = new CPU();
            Memory memory = new Memory();
            board.brand = "华擎0" + (i + 1);
            board.model = "Max00" + (i + 1);
            board.price = (double) ((int) (Math.random() * 300) + 100);
            bList[i] = board;
            gpu.brand = "NVIDIA0" + (i + 1);
            gpu.model = "GRX 40" + (i + 1) + 0;
            gpu.price = (double) ((int) (Math.random() * 300) + 100);
            gpu.videoMemory = (int) (Math.random() * 4 + 1) * 128;
            gList[i] = gpu;
            cpu.brand = "AMD 0" + (i + 1);
            cpu.model = "R" + (i + 3);
            cpu.price = (double) ((int) (Math.random() * 300) + 200);
            cpu.frameRate = (int) (Math.random() * 4 + 1) * 4 + "G";
            cList[i] = cpu;
            memory.brand = "金士顿0" + (i + 1);
            memory.model = "HX 0" + (i + 1);
            memory.price = (double) ((int) (Math.random() * 300) + 200);
            memory.memory = (int) (Math.random() * 8 + 1) * 128 + "G";
            memory.frameRate = (int) (Math.random() * 4 + 1) * 1024 + "HZ";
            mList[i] = memory;
        }
        Random random = new Random();
        int b, g, c, m;
        for (int i = 1; i <= 5; i++) {
            System.out.println("第" + i + "台电脑配置");
            b = random.nextInt(5);
            bList[b].print();
            g = random.nextInt(5);
            gList[g].print();
            c = random.nextInt(5);
            cList[c].print();
            m = random.nextInt(5);
            mList[m].print();
        }

    }
}
